// mapAqi.js
Page({
  data: {
    Height: 0,
    scale: 16,
    latitude: "",
    longitude: "",
    markers: [],
    circles: []
  },
  onLoad: function () {
    var _this = this;
    wx.getSystemInfo({
      success: function (res) {
        //设置map高度，根据当前设备宽高满屏显示
        _this.setData({
          view: {
            Height: res.windowHeight
          }
        })
      }
    })
    wx.getLocation({
      type: 'wgs84', // 默认为 wgs84 返回 gps 坐标，gcj02 返回可用于 wx.openLocation 的坐标
      success: function (res) {
        _this.setData({
          latitude: 24.366638,
          longitude: 118.046299,
          markers: [
            {
              id: "1",
              latitude: 24.366638,
              longitude: 118.046299,
              width: 22,
              height: 32,
              iconPath: "../img/marker.png",
              title: "生化C"
            },
            {
              id: "2",
              latitude: 24.366853,
              longitude: 118.047578,
              width: 22,
              height: 32,
              iconPath: "../img/marker.png",
              title: "主楼群3号"
            }
          ]

        })
      }
    })
  },
  //点击merkers
  markertap(e) {
    console.log(e.markerId)
    wx.navigateTo({
      url: '../particulars/particulars?id='+e.target.dataset.id,
      success: function (res) {
        // success
      },
      fail: function () {
        // fail
      },
      complete: function () {
        // complete
      }
    })
    /*wx.showActionSheet({
      itemList: ["A"],
      success: function (res) {
        console.log(res.tapIndex)
      },
      fail: function (res) {
        console.log(res.errMsg)
      }
    })*/
  }
})
